<?php

/**
 * Description of indexAction
\* www.teuker.nl - mail@teuker.nl
 * 
 * @author francisc
 */

class indexAction extends sfAction {

    public function execute($request) {
        $restaurants = SqlEngine::getRestaurants();
        
        $restaurant_id = $this->getUser()->getAttribute('current_restaurant_id');
        if (null == $restaurant_id)
            return $this->setTemplate('indexMinimal');

        $this->day_intervals = Util::getAllDaysIntervals($restaurant_id);
        $this->special_dates = SqlEngine::getSpecialDates(array('restaurant_id' => array('value' => $restaurant_id, 'type' => PDO::PARAM_INT)));
        $this->settings = SqlEngine::getSettings(array('restaurant_id' => array('value' => $restaurant_id, 'type' => PDO::PARAM_INT)));

        $this->emailHeaderFooterForm = new EmailHeaderFooterForm(array(
                    'header' => $this->settings['email_header'],
                    'footer' => $this->settings['email_footer']));
        
       
        $this->htmlHeaderFooterForm = new HtmlHeaderFooterForm(array(
                    'header' => $this->settings['header'],
                    'footer' => $this->settings['footer']));
		

        $this->menu_list = SqlEngine::getMenus(array('restaurant_id' => $restaurant_id));

        $this->block_times = SqlEngine::getBlockTimes(array('restaurant_id' => $restaurant_id));
    }
}
